<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.bean.GuestBook" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/1
  Time: 10:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>list</title>
    <script>
        //js
    </script>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>
<body>
<div>
    用户名:${sessionScope.user}
    <table class="table table-striped">
        <tr>
            <td>id</td>
            <td>name</td>
            <td>phone</td>
            <td>email</td>
            <td>title</td>
            <td>content</td>
            <td>createdtime</td>
            <td>操作</td>
        </tr>
<%--        <%--%>
<%--            //java代码部分--%>
<%--            //从request中获取到list集合,然后遍历集合--%>
<%--            List<Object> list = (List<Object>) request.getAttribute("list");--%>
<%--            for (int i = 0; i < list.size(); i++) {--%>
<%--                GuestBook gb = (GuestBook) list.get(i);--%>
<%--        %>--%>
        <%--   items接受一个集合${list}  ${requestScope.list}  var表示变量的名称     --%>
        <c:forEach var="gb" items="${list}" varStatus="status">
        <tr>
            <td>${status.index+1}</td>
            <td>${gb.name}</td>
            <td>${gb.phone}</td>
            <td>${gb.email}</td>
            <td>${gb.title}</td>
            <td>${gb.content}</td>
            <td>${gb.createdtime}</td>
            <td>
                <a href="/UserManagerWeb_war_exploded/manager?q=jumpAddMessage" class="btn btn-success">添加</a>
                <a href="/UserManagerWeb_war_exploded/manager?q=jumpUpdateMessage&id=${gb.ID}" class="btn btn-info">修改</a>
                <a href="/UserManagerWeb_war_exploded/manager?q=delete&id=${gb.ID}" class="btn btn-danger">删除</a>
            </td>
        </tr>
        </c:forEach>
<%--        <%--%>
<%--            }--%>
<%--        %>--%>
    </table>
</div>
</body>
</html>
